import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-11-03
 * Time: 11:39
 */
public class Test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        in.nextLine();
        String str = in.nextLine();
        int count = 0;
        for (int s = 0; s < n - 2; s++) {
            char ch1 = str.charAt(s);
            if (ch1 != 's') {
                continue;
            }
            for (int h = s + 1; h < n - 1; h++) {
                char ch2 = str.charAt(h);
                if (ch2 != 'h') {
                    continue;
                }
                for (int y = h + 1; y < n; y++) {
                    char ch3 = str.charAt(y);
                    if (ch3 != 'y') {
                        continue;
                    }
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}
